package cn.dogger.easyboot.init.enums;

import cn.dogger.easyboot.init.domain.FieldsEntity;
import lombok.Getter;
import net.bytebuddy.implementation.bytecode.constant.DefaultValue;

/**
 * 字段类型
 * @author dogger
 * 2022/7/19 21:25
 */
public enum FieldTypeEnums {
    //各个字段的默认值在枚举改
    bigint_,
    binary_,
    bit_,
    blob_,
    char_(10),
    date_,
    datetime_,
    decimal_(10,2),
    double_(5,2),
    enum_,
    float_(10,2),
    geometry_,
    geometrycollection_,
    int_(11),
    integer_,
    json_,
    linestring_,
    longblob_,
    varchar_(255),
    year_
    ;

    /**
     * 默认长度
     */
    @Getter
    private Integer fieldLength;
    @Getter
    private Integer decimalPoint;

     FieldTypeEnums(Integer fieldLength){
        this.fieldLength = fieldLength;
    }
    FieldTypeEnums(Integer fieldLength,Integer decimalPoint){
        this.fieldLength = fieldLength;
        this.decimalPoint = decimalPoint;
    }
    FieldTypeEnums(){
    }
    public static String getValue(FieldTypeEnums fieldType) {
        return fieldType.toString().substring(0, fieldType.name().length() - 1);
    }
}
